#include <stdio.h>
#include "oled.h"
#include "gui.h"
#include "test.h"
//16*16/8
// #define FONT_SIZE 32 //32 = 16*16/8
// unsigned char  font_array[][FONT_SIZE]={

// /*---------------硬----------------*/
// 0x00,0x00,0x01,0xFE,0xFC,0x20,0x10,0x20,0x11,0xFC,0x21,0x24,0x3D,0x24,0x65,0xFC,
// 0x65,0x24,0xA5,0x24,0x25,0xFC,0x25,0x20,0x3C,0xA0,0x24,0x40,0x20,0xB0,0x03,0x0E,

// /*---------------蛋----------------*/
// 0x7F,0xFC,0x01,0x04,0x11,0x00,0x11,0xF8,0x11,0x00,0x29,0x00,0x47,0xFE,0x81,0x00,
// 0x1F,0xF0,0x11,0x10,0x11,0x10,0x1F,0xF0,0x11,0x00,0x01,0x08,0x7F,0xFC,0x20,0x04,

// /*---------------科----------------*/
// 0x08,0x10,0x1D,0x10,0xF0,0x90,0x10,0x90,0x10,0x10,0xFD,0x10,0x10,0x90,0x38,0x90,
// 0x34,0x10,0x50,0x1E,0x53,0xF0,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,

// /*---------------技----------------*/
// 0x10,0x20,0x10,0x20,0x10,0x20,0x13,0xFE,0xFC,0x20,0x10,0x20,0x10,0x20,0x15,0xFC,
// 0x18,0x84,0x30,0x88,0xD0,0x48,0x10,0x50,0x10,0x20,0x10,0x50,0x51,0x88,0x26,0x06,

// /*---------------联----------------*/
// 0x00,0x88,0xFC,0x48,0x48,0x50,0x48,0x00,0x79,0xFC,0x48,0x20,0x48,0x20,0x78,0x20,
// 0x4B,0xFE,0x48,0x20,0x4C,0x50,0x78,0x50,0xC8,0x88,0x08,0x88,0x09,0x04,0x0A,0x02,

// /*---------------合----------------*/
// 0x01,0x00,0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x30,0x18,0xCF,0xE6,0x00,0x00,
// 0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,


// /*---------------人----------------*/
// 0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,
// 0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,0x10,0x10,0x20,0x08,0x40,0x04,0x80,0x02,

// /*---------------社----------------*/
// 0x20,0x20,0x10,0x20,0x10,0x20,0xF8,0x20,0x08,0x20,0x10,0x20,0x13,0xFE,0x38,0x20,
// 0x54,0x20,0x94,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x17,0xFE,0x10,0x00,

// /*---------------部----------------*/
// 0x10,0x00,0x08,0x3E,0x7F,0xA2,0x00,0x24,0x21,0x24,0x12,0x28,0xFF,0xE4,0x00,0x24,
// 0x00,0x22,0x3F,0x22,0x21,0x22,0x21,0x34,0x21,0x28,0x3F,0x20,0x21,0x20,0x00,0x20,
// };


void printString(int x,int y,int font_size,char *str){
    char *tmp_str = str;
    int cur_x=x;
    int cur_y=y;

    while(*tmp_str != '\0')
    {
        if(tmp_str[0] > 0){
          
            GUI_ShowChar(cur_x,cur_y,tmp_str[0],font_size,1);
            tmp_str++;
        }else{

            if(font_size == 16)
            {
                GUI_ShowFont16(cur_x,cur_y,tmp_str,1);
            }else if(font_size == 24){
                //自己实现
            }
            tmp_str +=3;
        
        }
        
        cur_x += font_size;
        if(cur_x > WIDTH-font_size)
		{
			cur_x=0;
			cur_y+=font_size;
		}
    }
}
// width: 64, height: 64
const unsigned char logo[]  = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf8,0xc0,0x00,0x7f,0xff,0xc0,0x00,0x1f,0xff,0xe0,0x00,0xff,0xff,0xe0,0x00,0x7f,0xff,0xe0,0x00,0xff,0xff,0xe0,0x00,0xff,0xff,0xe0,0x00,0xff,0xff,0xe0,0x01,0xf8,0x07,0xe0,0x00,0x00,0x03,0xc0,0x01,0xf0,0x03,0xe0,0x00,0x00,0x07,0xc0,0x03,0xe0,0x01,0xe0,0x00,0x00,0x07,0x80,0x07,0xc0,0x01,0xe0,0x00,0x00,0x0f,0x00,0x07,0xc0,0x01,0xe0,0x00,0x00,0x1f,0x00,0x07,0x80,0x01,0xe0,0x00,0x00,0x1e,0x00,0x0f,0x80,0x01,0xe0,0x00,0x00,0x3e,0x00,0x0f,0x00,0x01,0xe0,0x00,0x00,0x7c,0x00,0x0f,0x00,0x01,0xe0,0x00,0x00,0x78,0x00,0x0f,0x00,0x01,0xe0,0x00,0x00,0xf8,0x00,0x0f,0x00,0x01,0xe0,0x00,0x01,0xf0,0x00,0x0f,0x00,0x01,0xe0,0x00,0x01,0xe0,0x00,0x0f,0x00,0x01,0xe0,0x00,0x03,0xe0,0x00,0x0f,0x00,0x01,0xe0,0x00,0x07,0xc0,0x00,0x0f,0x00,0x01,0xe0,0x00,0x07,0x80,0x00,0x0f,0x80,0x01,0xe0,0x00,0x0f,0x80,0x00,0x0f,0x80,0x01,0xe0,0x00,0x0f,0x00,0x00,0x07,0x80,0x01,0xe0,0x00,0x1e,0x00,0x00,0x07,0xc0,0x01,0xe0,0x00,0x3e,0x00,0x00,0x07,0xc0,0x01,0xe0,0x00,0x3c,0x00,0x00,0x03,0xe0,0x01,0xe0,0x00,0x78,0x00,0x00,0x03,0xf0,0x03,0xe0,0x00,0xf8,0x00,0x00,0x01,0xf8,0x07,0xe0,0x00,0xf0,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x07,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
void test_led_screen(void)
{	
  
    printf("before oled clear \r\n");
    OLED_Init();			   //初始化OLED  

    while(1){    
        OLED_Clear(0);             //清屏（全黑）
        printf("after oled clear \r\n");




        int x=0;
        int y=0;

        // for(int i=0;i<60;i++){

            
        //     OLED_Clear(0);     
        //     GUI_ShowNum(x,y,717,3,16,1);
        //     x +=2;
        //     OLED_Display();
        //     usleep(500*1000);
        // }

        // GUI_DrawCircle(10, 10,1, 8);

        // GUI_FillRectangle(20,0,30,50,1);

        // int font_len = sizeof(font_array)/FONT_SIZE;

        // for(int i=0;i<font_len;i++){

        //     GUI_FillData(x,y,16,16,font_array[i],FONT_SIZE,1);
        //     x += 16;
        //     if(x>=120){
        //         x = 0;
        //         y +=16;
        //     }
        // }
       // GUI_ShowChinese(0,0,16,"鸿蒙硬蛋科技人社部今天联合硬蛋",1);

    //    printString(0,0,16,"hello 硬蛋科技 123@Ingdan!!鸿蒙人社部今天联合硬蛋");
        GUI_DrawBMP(0,0,64, 64, logo,  1 );
        OLED_Display();
        sleep(3);

    }
   
}

